/**
 *
 */
package com.seelyn.dowork.service;


import com.seelyn.dowork.entities.Category;
import com.seelyn.dowork.entities.CategoryExample;
import com.seelyn.dowork.entities.Course;
import com.seelyn.dowork.entities.CourseExample;
import com.seelyn.dowork.repositories.CategoryMapper;
import com.seelyn.dowork.repositories.CourseMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author Siva
 */
@Service
@Transactional
public class CourseService {

    @Autowired
    CategoryMapper courseRepository;

    public Category findCourseById(Long postId) {
        return courseRepository.selectByPrimaryKey(postId);
    }

    public int save(Category course) {
        return courseRepository.insert(course);
    }

    public void deleteCourse(Long postId) {
        courseRepository.deleteByPrimaryKey(postId);
    }

    public List<Category> findComments(CategoryExample example) {
        return courseRepository.selectByExample(example);
    }
}
